package com.md.controller;

import com.md.entity.Student;
import com.md.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.xml.ws.RequestWrapper;
import java.util.List;


@Controller
@ResponseBody
@CrossOrigin
public class StudentCon {
    @Autowired
    private StudentService studentService;

    @RequestMapping("/selectAll")
    public List<Student> selectAll() {
        return studentService.selectAll();
    }

    @RequestMapping("/selectById")
    public Student selectById(int id) {
        return studentService.selectById(id);
    }

    @RequestMapping("/deleteById")
    public int deleteById(int id) {
        return studentService.deleteById(id);
    }
    @RequestMapping("/updateById")
    public int updateById(Student student) {
        return studentService.updateById(student);
    }
    @RequestMapping("/insertById")
    public List<Student> insertById(Student student) {
        return studentService.insertById(student);
    }

    @RequestMapping("/selectByIds")
    public List<Student> selectByIds(String studentName) {
        return studentService.selectByIds(studentName);
    }
}
